package com.story.modular.app.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.story.common.persistence.model.CategoryClass;
import com.story.common.persistence.model.Dept;
import com.story.modular.app.dao.CategoryclassDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.story.modular.app.service.ICategoryclassService;

import java.util.List;

/**
 * 首页类别Service
 *
 * @author fengshuonan
 * @Date 2020-04-29 15:42:54
 */
@Service
public class CategoryclassServiceImpl implements ICategoryclassService {


    @Autowired
    private CategoryclassDao categoryclassDao;

    @Override
    public int save(CategoryClass record) {
        return categoryclassDao.insert(record);
    }

    @Override
    public int delete(CategoryClass record) {
        return categoryclassDao.deleteById(record.getId());
    }

    @Override
    public int delete(List<CategoryClass> records) {
        return 0;
    }

    @Override
    public CategoryClass findById(Integer id) {
        return categoryclassDao.selectById(id);
    }

    @Override
    public int update(CategoryClass record) {
        return categoryclassDao.updateById(record);
    }

    @Override
    public List<CategoryClass> quyerList(CategoryClass record) {
        Wrapper<CategoryClass> wrapper = new EntityWrapper<>();

        return categoryclassDao.selectList(wrapper);
    }

    @Override
    public List<CategoryClass> queryPageList(Page<CategoryClass> page, String name) {
        return categoryclassDao.queryPageList(page,name);
    }
}
